/**
 * SQL语句的封装类
 * 包含可含有占位符的SQL语句与占位符值
 */
package cn.antia.db;

import java.util.Arrays;

/**
 * @author Jair Shaw
 * @date Dec 25, 2007
 * @time 2:57:30 PM
 */
public class SqlParams {
	private String sql;			//sql语句
	private Object[] params;	//如果SQL语句中含有占位符，那么paraValues的值就是顺序对应的占位符值

    public SqlParams() {
    }

    public SqlParams(String sql, Object[] params) {
        this.sql = sql;
        this.params = params;
    }

    public Object[] getParams() {
		return params;
	}
	public void setParams(Object[] params) {
		this.params = params;
	}
	public String getSql() {
		return sql;
	}
	public void setSql(String sql) {
		this.sql = sql;
	}

    @Override
    public String toString() {
        StringBuffer msg = new StringBuffer("");
        msg.append(" Query: ");
        msg.append(sql);
        msg.append(" Parameters: ");
        if (params == null) {
            msg.append("[]");
        } else {
            msg.append(Arrays.asList(params));
        }
        return msg.toString();
    }
}
